package com.example.demo.mapper;

import com.example.demo.entity.Student;
import org.apache.ibatis.annotations.*;

import java.sql.Date;
import java.util.List;

@Mapper
public interface StudentMapper {
    @Select("select * from student order by sid")
    List<Student> findAll();
    @Delete("delete from student where sid = #{sid}")
    void delete(String sid);
    @Update("update student set name = #{name}, age = #{age}, gender = #{gender}, birthday = #{birthday}  where sid = #{sid}")
    void update(@Param("name") String name, @Param("age") int age, @Param("gender") String gender, @Param("birthday") Date birthday, @Param("sid") String sid);
    @Insert("insert into student (sid,name,age,gender,birthday)" +
            " values (#{sid}," +
            "#{name},#{age},#{gender}," +
            "#{birthday}) ")
    void add(String sid, String name, int age, String gender, Date birthday);
}
